var global = {
	version : external.max_version,
	currentLanguage : "cn",
	hideCornerTimer : {},
	showCornerTimer : {},
	hideCtrlTimer : {},
	showCtrlTimer : {},
	engineMap : {
		1 : true,
		2 : true,
		3 : true,
		4 : true,
		101 : true,
		102 : true,
		103 : true
	},
	dialLayout : {
		normal : {
			grid : {
				w : 800,
				h : 480
			},
			dial : {
				w : 200,
				h : 160
			},
			map : [ {
				l : 10,
				t : 15
			}, {
				l : 210,
				t : 15
			}, {
				l : 410,
				t : 15
			}, {
				l : 610,
				t : 15
			}, {
				l : 10,
				t : 175
			}, {
				l : 210,
				t : 175
			}, {
				l : 410,
				t : 175
			}, {
				l : 610,
				t : 175
			}, {
				l : 10,
				t : 335
			}, {
				l : 210,
				t : 335
			}, {
				l : 410,
				t : 335
			}, {
				l : 610,
				t : 335
			} ]
		},
		small : {
			grid : {
				w : 720,
				h : 432
			},
			dial : {
				w : 180,
				h : 144
			},
			map : [ {
				l : 10,
				t : 15
			}, {
				l : 190,
				t : 15
			}, {
				l : 370,
				t : 15
			}, {
				l : 550,
				t : 15
			}, {
				l : 10,
				t : 159
			}, {
				l : 190,
				t : 159
			}, {
				l : 370,
				t : 159
			}, {
				l : 550,
				t : 159
			}, {
				l : 10,
				t : 303
			}, {
				l : 190,
				t : 303
			}, {
				l : 370,
				t : 303
			}, {
				l : 550,
				t : 303
			} ]
		},
		large : {
			grid : {
				w : 1000,
				h : 600
			},
			dial : {
				w : 250,
				h : 200
			},
			map : [ {
				l : 10,
				t : 15
			}, {
				l : 260,
				t : 15
			}, {
				l : 510,
				t : 15
			}, {
				l : 760,
				t : 15
			}, {
				l : 10,
				t : 215
			}, {
				l : 260,
				t : 215
			}, {
				l : 510,
				t : 215
			}, {
				l : 760,
				t : 215
			}, {
				l : 10,
				t : 415
			}, {
				l : 260,
				t : 415
			}, {
				l : 510,
				t : 415
			}, {
				l : 760,
				t : 415
			} ]
		}
	}
};
var Layout = {
	init : function() {
		global.displayMode = true;
		global.focusMode = true;
		Layout.checkDisplay();
		Layout.resize();
		window.onresize = Layout.resize;
		window.onkeydown = function() {
			if (event.keyCode == 27) {
				if (global.editorIndex >= 0) {
					DialEditor.hide()
				}
				if (global.draggingIndex >= 0) {
					DialDnd.cancel()
				}
			}
		};
		window.onfocus = function() {
			global.focusMode = true;
			Layout.resize()
		};
		window.onblur = function() {
			global.focusMode = false
		};
		global.currentLanguage = "cn";
		var B = (global.currentLanguage == "cn") ? "http://go.maxthon.cn/"
				: "http://go.maxthon.com/";
		var A = B + "redir/public/feature_post.htm?f=mx3quickaccess&v="
				+ global.version;
		$("btn-feedback").setAttribute("href", A)
	},
	resize : function() {
		if (!global.displayMode) {
			return
		}
		if (!global.focusMode) {
			return
		}
		var A = window.innerWidth;
		var D = window.innerHeight;
		if (A > 1000 && D > 740) {
			global.displaySize = "large";
			document.body.className = "large-body"
		} else {
			if (A < 800 || D < 620) {
				global.displaySize = "small";
				document.body.className = "small-body"
			} else {
				global.displaySize = "normal";
				document.body.className = "normal-body"
			}
		}
		var C = $("dial-editor");
		if (global.editorIndex >= 0) {
			var A = C.offsetWidth;
			var D = C.offsetHeight;
			var E = document.body.scrollWidth;
			var B = document.body.offsetHeight;
			C.style.left = (E - A) / 2 + "px";
			C.style.top = (B - D) / 2 + "px"
		}
	},
	checkDisplay : function() {
		$("wrapper").className = global.displayMode ? "wrapper"
				: "wrapper blank";
		//Data.setUeip("toggle_grid", (global.displayMode ? "1" : "0"));
		Layout.resize();
	}
};
var Engine = {
	init : function() {
		var D = $("search-logo");
		var B = $("search-btn");
		var A = $("search-keywords");
		D.onerror = ImgError.engine;
		D.parentNode.onclick = function() {
			Menu.showEngineList()
		};
		B.onclick = function() {
			if ($("search-keywords").value) {
				Data.countUeip("c", "search_method")
			} else {
				Data.countUeip("f", "search")
			}
			Engine.search()
		};
		A.onkeydown = function() {
			if (event.keyCode == 13) {
				if ($("search-keywords").value) {
					Data.countUeip("k", "search_method")
				} else {
					Data.countUeip("f", "search")
				}
				Engine.search()
			}
		};
		var C = Engine.getCurrent();
		Engine.setCurrent(C)
	},
	search : function() {
		Data.countUeip("c", "search_" + Engine.getCurrent());
		var A = $("search-keywords");
		Data.doSearch(A.value)
	},
	getCurrent : function() {
		return "google";
	},
	setCurrent : function(E) {
		var C = $("search-logo");
		var B = $("search-btn");
		//var F = Data.getEngineList();
		var F = new Array();
		F[0] = "engine_default";
		F[1] = "yahoo";
		F[2] = "bing";
		
		/*
		var I = "";
		var A = "";
		var H = "";
		if (global.engineMap[E]) {
			I = "images/search/logo_" + E + ".png";
			if (E == 3 && Data._locale.locale == "zh-cn") {
				I = "images/search/logo_" + E + "_cn.png"
			}
		}
		
		for ( var D = 0; D < F.length; D++) {
			var G = F[D];
			if (G.id == E) {
				if (!I) {
					I = "mx://favicon/[0]" + G.url
				}
				A = G.name;
				H = G.label
			}
		}
		C.src = I;
		C.title = C.alt = A;
		B.title = B.innerHTML = H
		*/
	},
	eventHandler : function(A) {
		Engine.setCurrent(A.target)
	}
};
var DialList = {
	init : function() {
		DialList.build();
		var E = $("dial-ctrl");
		var A = $("btn-edit");
		var C = $("btn-refresh");
		var B = $("btn-del");
		var D = $("btn-open-new");
		E.onclick = function() {
			return false
		};
		A.onclick = function() {
			var F = global.ctrlIndex;
			if (F >= 0) {
				DialEditor.show(F);
				Data.countUeip("c", "d_ctrl_edit")
			}
		};
		C.onclick = function() {
			var F = global.ctrlIndex;
			if (F >= 0) {
				Dial.refresh(F);
				Data.countUeip("c", "d_ctrl_refresh")
			}
		};
		B.onclick = function() {
			var F = global.ctrlIndex;
			if (F >= 0) {
				Dial.del(F);
				Data.countUeip("c", "d_ctrl_del")
			}
		};
		D.onmouseover = DialCtrl.onCorner;
		D.onmouseout = DialCtrl.offCorner;
		D.onclick = function() {
			var F = global.cornerIndex;
			if (F >= 0) {
				Dial.openNew(F);
				Data.countUeip("c", "d_new_tab")
			}
			return false
		}
	},
	build : function() {
		/*
		var C = $("content");
		var G = Data.getDialList();
		global.dialData = {};
		var B = 0;
		for ( var E = 0; E < G.length; E++) {
			var A = G[E];
			var F = {
				id : E,
				url : A.url,
				title : A.title,
				timestamp : A.lastModified
			};
			var D = Dial.create(E);
			Dial.setData(D, F);
			global.dialData[E] = F;
			C.appendChild(D);
			if (F.url) {
				B++
			}
			(function(H) {
				H.oncontextmenu = function() {
					Menu.showDialMenu(H);
					return false
				};
				H.onmouseover = function() {
					DialCtrl.show(H)
				};
				H.onmouseout = function() {
					DialCtrl.hide(H)
				};
				H.ondragstart = function() {
					DialDnd.start(H);
					return false
				}
			})(D)
		}
		Data.setUeip("dial_grid", B)*/
	}
};
var Dial = {
	create : function(B) {
		var A = $new("a");
		A.className = "dial";
		A.id = "dial-" + B;
		A.href = "#";
		A.dialId = B;
		return A
	},
	setData : function(A, B) {
		if (B.url) {
			if (B.isLoading) {
				Dial.setLoading(A, B)
			} else {
				Dial.setNormal(A, B)
			}
		} else {
			Dial.setBlank(A)
		}
	},
	setNormal : function(B, D) {
		B.href = D.url;
		B.onclick = function() {
			if ($("dial-ctrl").contains(event.target)) {
				return
			}
			if ($("dial-corner").contains(event.target)) {
				return
			}
			if (event.button == 0) {
				if (event.shiftKey) {
					Data.countUeip("c", "d_shift")
				} else {
					Data.countUeip("c", "dial")
				}
			} else {
				if (event.button == 1) {
					Data.countUeip("m", "dial")
				}
			}
		};
		B.title = D.title;
		if (B.innerHTML == "" || B.isBlank) {
			B.innerHTML = '<span class="inner"><img class="favicon" onerror="ImgError.favicon(this)" src="mx://favicon/['
					+ D.timestamp
					+ "]"
					+ D.url
					+ '" />'
					+ (encodeHtml(D.title) || D.url)
					+ '<img class="thumb" onerror="ImgError.thumb(this)" src="mx://thumbs/['
					+ D.timestamp + "]" + D.id + '" /></span>';
			B.isBlank = false
		} else {
			var C = B.firstChild.firstChild;
			C.src = "mx://favicon/[" + D.timestamp + "]" + D.url;
			var E = C.nextSibling;
			E.textContent = D.title || D.url;
			var A = E.nextSibling;
			A.src = "mx://thumbs/[" + D.timestamp + "]" + D.id
		}
	},
	setLoading : function(A, B) {
		A.innerHTML = '<span class="inner"><img class="favicon" src="images/favicon_default.png" />'
				+ B.url
				+ '<img class="thumb loading" src="images/s.png" /></span>';
		A.href = B.url;
		A.onclick = function() {
			if ($("dial-corner").contains(event.target)) {
				return
			}
			if ($("dial-ctrl").contains(event.target)) {
				return
			}
			if (event.button == 0) {
				if (event.shiftKey) {
					Data.countUeip("c", "d_shift")
				} else {
					Data.countUeip("c", "dial")
				}
			} else {
				if (event.button == 1) {
					Data.countUeip("m", "dial")
				}
			}
		};
		A.title = B.url
	},
	setBlank : function(A) {
		A.innerHTML = '<table class="empty-content"><tr><td>'
				+ Data.getLang("QuickAccess!Add") + "</td></tr></table>";
		A.href = "#";
		A.onclick = function() {
			return false
		};
		A.title = Data.getLang("QuickAccess!Add");
		A.firstChild.onclick = function() {
			Data.countUeip("c", "blank_dial");
			DialEditor.show(A.dialId)
		};
		A.isBlank = true
	},
	open : function(A) {
		var B = global.dialData[A];
		if (B.url) {
			location = B.url
		}
	},
	openNew : function(A) {
		var B = global.dialData[A];
		if (B.url) {
			window.open(B.url, "_blank", "-mx-active=no")
		}
	},
	edit : function(B, A) {
		$("dial-" + B).isBlank = false;
		global.dialData[B].url = A;
		Dial.refresh(B)
	},
	refresh : function(B) {
		var A = global.dialData[B].url;
		Data.setDial(B, A)
	},
	del : function(A) {
		Data.setDial(A, "")
	},
	eventHandler : function(C) {
		if (C.type == "SHOW_CHANGED") {
			global.displayMode = Data.isShown();
			Layout.checkDisplay();
			return
		}
		var G = C.target;
		var F = Data.getDialList();
		var E = F[G];
		global.dialData[G] = {
			id : C.target,
			url : E.url,
			title : E.title,
			timestamp : E.lastModified
		};
		if (C.type == "THUMB_LOADING") {
			global.dialData[G].isLoading = true
		}
		var D = $("dial-" + G);
		var B = global.cornerIndex;
		if (B >= 0) {
			var A = $("dial-" + B);
			$("layers").appendChild($("dial-corner"));
			$("layers").appendChild($("dial-ctrl"))
		}
		Dial.setData(D, global.dialData[G]);
		if (A && global.dialData[B].url) {
			A.appendChild($("dial-corner"));
			A.appendChild($("dial-ctrl"))
		}
	}
};
var DialCtrl = {
	show : function(B) {
		if (B.isBlank) {
			return
		}
		var A = B.dialId;
		if (global.hideCornerTimer[A]) {
			clearTimeout(global.hideCornerTimer[A])
		}
		if (global.hideCtrlTimer[A]) {
			clearTimeout(global.hideCtrlTimer[A])
		}
		global.showCornerTimer[A] = setTimeout(function() {
			global.cornerIndex = A;
			B.appendChild($("dial-corner"))
		}, 1);
		global.showCtrlTimer[A] = setTimeout(function() {
			global.ctrlIndex = A;
			B.appendChild($("dial-ctrl"))
		}, 300)
	},
	hide : function(B) {
		if (B.isBlank) {
			return
		}
		var A = B.dialId;
		if (global.showCornerTimer[A]) {
			clearTimeout(global.showCornerTimer[A])
		}
		if (global.showCtrlTimer[A]) {
			clearTimeout(global.showCtrlTimer[A])
		}
		global.hideCornerTimer[A] = setTimeout(function() {
			global.cornerIndex = -1;
			$("layers").appendChild($("dial-corner"))
		}, 1);
		global.hideCtrlTimer[A] = setTimeout(function() {
			global.ctrlIndex = -1;
			$("layers").appendChild($("dial-ctrl"))
		}, 13)
	},
	onCorner : function() {
		$("dial-corner").style.backgroundPosition = "1px -1px"
	},
	offCorner : function() {
		$("dial-corner").style.backgroundPosition = "0 0"
	}
};
var DialEditor = {
	build : function() {
		var editor = $("dial-editor");
		editor.innerHTML = '<div class="dialog-header"><div class="dialog-title">'
				+ Data.getLang("QuickAccess!EditorTitle")
				+ '</div><div class="dialog-ctrl"><a href="#" class="btn-close" title="'
				+ Data.getLang("QuickAccess!Close")
				+ '" onclick="DialEditor.hide(); return false;"></a></div></div><div id="editSearch-c" class="dialog-content"><p><input style="width: 270px;" type="text" id="dial-editor-url" onkeydown="if (event.keyCode == 13) {$(\'btn-save\').click();} else {global.editMode = \'input\';}" placeholder="'
				+ Data.getLang("QuickAccess!UrlPlaceHolder")
				+ '" title="'
				+ Data.getLang("QuickAccess!UrlPlaceHolder")
				+ '" type="text" /></p><div class="recommended-list"><fieldset><legend onclick="DialEditor.toggleSmartList($(\'fav-list\'))">'
				+ Data.getLang("QuickAccess!MostVisited")
				+ '</legend><ul id="fav-list"></ul></fieldset> <fieldset><legend onclick="DialEditor.toggleSmartList($(\'history-list\'))">'
				+ Data.getLang("QuickAccess!LastVisited")
				+ '</legend><ul id="history-list"></ul></fieldset> </div></div><div class="dialog-footer"><div class="dialog-ctrl"><button id="btn-save" title="'
				+ Data.getLang("QuickAccess!Save")
				+ '">'
				+ Data.getLang("QuickAccess!Save")
				+ '</button><button onclick="DialEditor.hide()" title="'
				+ Data.getLang("QuickAccess!Cancel")
				+ '">'
				+ Data.getLang("QuickAccess!Cancel") + "</button></div></div>";
		if (!Data._favorites) {
			try {
				eval("runtime.import('maxthon.browser.favorites')");
				Data._favorites = runtime.FavManager;
				Data.getFavList = function() {
					return Data._favorites.getMostVisitNodes(15)
				}
			} catch (e) {
				Data._favorites = null
			}
		}
		DialEditor.setSmartList($("fav-list"), Data.getFavList());
		if (!Data._history) {
			try {
				eval("runtime.import('maxthon.browser.history')");
				Data._history = runtime.HistoryManager;
				Data.getRecentList = function() {
					return Data._history.getRecentList(15)
				}
			} catch (e) {
				Data._history = null
			}
		}
		DialEditor.setSmartList($("history-list"), Data.getRecentList());
		$("btn-save").onclick = function() {
			var index = global.editorIndex;
			Dial.edit(index, $("dial-editor-url").value);
			DialEditor.hide();
			if (global.editMode == "input") {
				Data.countUeip("c", "save_from_input")
			}
			if (global.editMode == "click") {
				Data.countUeip("c", "save_from_recomm")
			}
			if (global.editMode == "dblclick") {
				Data.countUeip("d", "recomm_item")
			}
			if (global.editSrc == "fav-list") {
				Data.countUeip("c", "most_item")
			}
			if (global.editSrc == "history-list") {
				Data.countUeip("c", "recent_item")
			}
			global.editMode = "";
			global.editSrc = ""
		}
	},
	show : function(B) {
		if (B < 0) {
			return
		}
		var E = $("dial-editor");
		if (E.innerHTML == "") {
			DialEditor.build()
		}
		global.editorIndex = B;
		var F = global.dialData[B];
		$("dial-editor-url").value = F ? F.url : "";
		document.body.appendChild($("mask"));
		document.body.appendChild($("dial-editor"));
		var A = $("dial-editor").offsetWidth;
		var D = $("dial-editor").offsetHeight;
		var G = document.body.scrollWidth;
		var C = document.body.offsetHeight;
		$("dial-editor").style.left = (G - A) / 2 + "px";
		$("dial-editor").style.top = (C - D) / 2 + "px";
		if (F && F.url) {
			$("dial-editor-url").select()
		} else {
			$("dial-editor-url").focus()
		}
		global.hoverIndex = B;
		$addClass($("dial-" + B), "hover")
	},
	hide : function() {
		global.editorIndex = -1;
		$("layers").appendChild($("dial-editor"));
		$("layers").appendChild($("mask"));
		var A = global.hoverIndex;
		$removeClass($("dial-" + A), "hover");
		global.hoverIndex = -1
	},
	setSmartList : function(A, D) {
		var B = [];
		for ( var C = 0; C < D.length; C++) {
			var E = D[C];
			B
					.push("<li					onmousedown=\"return false;\"					onclick=\"						global.editMode = 'click';						global.editSrc = '"
							+ A.id
							+ "';						$('dial-editor-url').value = '"
							+ encodeHtml(E.url)
							+ "';					\"					ondblclick=\"						global.editMode = 'dblclick';						$('btn-save').click();					\"					title=\""
							+ encodeHtml(E.title)
							+ '"				>					<img alt="" class="favicon" src="mx://favicon/['
							+ E.lastModified
							+ "]"
							+ E.url
							+ '" onerror="ImgError.favicon(this)" />					<span class="title">'
							+ encodeHtml(E.title) + "</span>				</li>")
		}
		if (B.length > 0) {
			A.innerHTML = B.join("")
		} else {
			A.innerHTML = '<li class="empty-tips">'
					+ Data.getLang("QuickAccess!NothingRecommended")
		}
		+"</li>"
	},
	toggleSmartList : function(A) {
		A.style.display = (A.style.display != "none") ? "none" : "block"
	}
};
var DialDnd = {
	start : function(C) {
		event.preventDefault();
		C.style.cssText = "z-index: 20; -webkit-transition: none;";
		document.body.appendChild($("mask"));
		var B = C.dialId;
		global.draggingIndex = B;
		global.draggingDial = C;
		var A = global.displaySize;
		var E = global.dialLayout[A];
		var D = E.map[B];
		global.startX = event.clientX + document.body.scrollLeft - D.l;
		global.startY = event.clientY + document.body.scrollTop - D.t;
		window.onmousemove = DialDnd.move;
		window.onmouseup = DialDnd.end
	},
	move : function() {
		var C = event.clientX + document.body.scrollLeft - global.startX;
		var B = event.clientY + document.body.scrollTop - global.startY;
		var A = global.draggingDial;
		A.style.left = C + "px";
		A.style.top = B + "px"
	},
	end : function() {
		var C = global.displaySize;
		var A = global.dialLayout[C];
		var I = event.clientX + document.body.scrollLeft;
		var H = event.clientY + document.body.scrollTop;
		var F = $("content");
		while (F) {
			I -= F.offsetLeft;
			H -= F.offsetTop;
			F = F.offsetParent
		}
		var K;
		if (I > 0 && H > 0 && I < A.grid.w && H < A.grid.h) {
			var B = Math.floor(I / (A.dial.w + 20));
			var N = Math.floor(H / (A.dial.h + 30));
			K = N * 4 + B
		}
		var G = global.draggingIndex;
		var M = global.draggingDial;
		if (K == null || G == K) {
			var L = A.map[G];
			M.style.cssText = "";
			Data.countUeip("f", "d_dnd")
		} else {
			var E = $("dial-" + K);
			var D = A.map[G];
			var J = A.map[K];
			M.style.cssText = "";
			E.style.cssText = "";
			M.id = "dial-" + K;
			E.id = "dial-" + G;
			M.dialId = K;
			E.dialId = G;
			global.cornerIndex = global.ctrlIndex = K;
			setTimeout(function() {
				Data.swapDial(K, G)
			}, 13);
			Data.countUeip("t", "d_dnd")
		}
		$("layers").appendChild($("mask"));
		M.style.cssText = "";
		global.draggingDial = global.draggingIndex = global.startX = global.startY = window.onmousemove = window.onmouseup = null
	},
	cancel : function() {
		var A = global.draggingDial;
		var B = global.draggingIndex;
		A.style.cssText = "";
		$("layers").appendChild($("mask"));
		global.draggingDial = global.draggingIndex = global.startX = global.startY = window.onmousemove = window.onmouseup = null;
		Data.countUeip("f", "d_dnd")
	}
};
var Footer = {
	/*
	init : function() {
		$("btn-settings").onclick = function() {
			Menu.showSettings();
			return false
		};
		$("version").innerText = Data.getLang("QuickAccess!Maxthon") + " v"
				+ external.max_version
	}*/
};
var ImgError = {
	engine : function() {
		event.target.src = "images/engine_default.png"
	},
	favicon : function() {
		event.target.src = "images/favicon_default.png"
	},
	thumb : function() {
		event.target.src = "images/thumb_default.png"
	}
};
var Menu = {
	show : function(C, B) {
		var A = event.clientX;
		var D = event.clientY;
		if (C) {
			A = -document.body.scrollLeft;
			D = -document.body.scrollTop + C.offsetHeight;
			while (C) {
				A += C.offsetLeft;
				D += C.offsetTop;
				C = C.offsetParent
			}
		}
		return Data.popupMenu(A, D, B)
	},
	showEngineList : function() {
		var A = [];
		var E = Data.getEngineList();
		for ( var B = 0; B < E.length; B++) {
			var C = E[B];
			A.push({
				id : C.id,
				label : C.name,
				type : "radio",
				checked : (C.id == Data.getEngine())
			})
		}
		var D = Menu.show($("search-logo").parentNode, A);
		if (D && D != Data.getEngine()) {
			Data.countUeip("c", "engine_list");
			Data.setEngine(D)
		}
	},
	showDialMenu : function(C) {
		var B = C.dialId;
		var A = [ {
			id : "open",
			label : Data.getLang("QuickAccess!Open")
		}, {
			id : "openNew",
			label : Data.getLang("QuickAccess!OpenNew")
		}, {
			type : "separator"
		}, {
			id : "edit",
			label : Data.getLang("QuickAccess!Edit")
		}, {
			id : "refresh",
			label : Data.getLang("QuickAccess!Refresh")
		}, {
			id : "del",
			label : Data.getLang("QuickAccess!Delete")
		} ];
		if (!global.dialData[B].url) {
			A[0].disabled = A[1].disabled = A[4].disabled = A[5].disabled = true
		}
		var D = Menu.show(null, A);
		if (D == "open") {
			Dial.open(B)
		} else {
			if (D == "openNew") {
				Dial.openNew(B)
			} else {
				if (D == "edit") {
					DialEditor.show(B);
					Data.countUeip("c", "d_menu_edit")
				} else {
					if (D == "refresh") {
						Dial.refresh(B);
						Data.countUeip("c", "d_menu_refresh")
					} else {
						if (D == "del") {
							Dial.del(B);
							Data.countUeip("c", "d_menu_del")
						}
					}
				}
			}
		}
	},
	showSettings : function() {
		var A = [ {
			id : "show",
			label : Data.getLang("QuickAccess!ShowDialList")
		}, {
			id : "hide",
			label : Data.getLang("QuickAccess!HideDialList")
		}, {
			id : "reset",
			label : Data.getLang("QuickAccess!ResetToDefault")
		} ];
		if (global.displayMode) {
			A[0].visible = false
		} else {
			A[1].visible = false
		}
		var B = Menu.show($("btn-settings"), A);
		if (B == "show") {
			Data.setShown(true)
		} else {
			if (B == "hide") {
				Data.setShown(false)
			} else {
				if (B == "reset") {
					Data.reset()
				}
			}
		}
	}
};
(function() {
	Data.init();
	Layout.init();
	Engine.init();
	//Data.bindEngineEvent(Engine.eventHandler);
	DialList.init();
	//Data.bindDialEvent(Dial.eventHandler);
	//Footer.init()
})();